home *** CD-ROM | disk | FTP | other *** search
-
- // ───────────────────────────────────────────────────────────────────
- // The Aurora Editor v2.0
- // Copyright 1993-1995 nuText Systems. All Rights Reserved Worldwide.
- //
- // Detab (tab expansion) and Entab (tab compression) macro
- //
- // Converts tabs to spaces in the current file (detab), or converts
- // spaces to tabs (entab) The conversion is limited to a marked block if
- // it exists in the current file. The current value of the _TabWidth
- // configuration variable is used as the tab width.
- //
- // (Note: this macro will run faster if undo is disabled)
- // ───────────────────────────────────────────────────────────────────
-
- // compile time macros and function definitions
- include bootpath "define.aml"
-
- if not objtype? "edit" then
- msgbox "Edit windows only!"
- return
- end
-
- // mark beginning of undoable group
- undobegin
-
- // test for mark in current window
- if mark? then
- if getmarkbuf <> getcurrbuf then
- msgbox "Block not marked in current window"
- return
- end
- // create temp mark covering the entire file
- else
- markline 1 (getlines)
- temp_mark = TRUE
- end
-
- // check if entab was specified
- entab = (arg 2) == 'e'
-
- // use built-in tabblock function for both detab and entab
- tabblock (if? entab -_TabWidth _TabWidth)
- if temp_mark then
- destroymark
- end
-
- undoend
-
- display
- say (if? entab "Entab " "Detab ") +
- (if? not temp_mark "block ") + "done."
-
-